#ifndef _SYN_OSCILLATOR_H
#define _SYN_OSCILLATOR_H

#include "syncommon.h"
#include "synblepbuffer.h"

namespace Synth
{

enum OscType
{
	ot_DLS,
	ot_Saw,
	ot_Pulse,
	ot_Sine,
	ot_Triangle,
	ot_WhiteNoise,
	ot_PinkNoise
};

class Oscillator {
	Audio::DLS::Instrument *instrument;
	const Audio::DLS::Region *region;

	unsigned int sample;
	unsigned int samplefrac;
	unsigned int delta;

	double pos, v;
	float note_offset, sr;
	bool playing;
	int type;
	BlepBuffer blep;

public:
	int paramOffset;

	int Start(int type, int ins, float note);
	void SetFreq(float note);
	void Render(Block buffer, const float *fm_input);
};

}

#endif